package ooday05;public class StaticDemo {
    public static void main(String[] args) {
        StaticVar staticVar = new StaticVar();
        staticVar.show();
        StaticVar staticVar1 = new StaticVar();
        staticVar1.show();
        StaticVar staticVar2 = new StaticVar();
        staticVar2.show();
        //因为a作为实例变量，每次创建一个实例对象时，就有一个新的实例变量即a出现
        //而b作为静态变量，属于类变量，编译为字节码后，储存在方法区中，和对象创建无关。
        System.out.println(staticVar2.a);
        System.out.println(StaticVar.b);
        StaticBlock staticBlock = new StaticBlock();
        StaticBlock staticBlock1 =new StaticBlock();
        StaticBlock staticBlock2 = new StaticBlock();
    }
}
